//
//  AddAddressViewController.swift
//  Eternity
//
//  Created by cll12_12 on 2016/12/16.
//  Copyright © 2016年 ZhengWei. All rights reserved.
//

import UIKit

class AddAddressViewController: BaseViewController {

    // MARK: - life cycle
    override func viewDidLoad() {
        super.viewDidLoad()
        
        configUI()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    // MARK: - private method
    func configUI() {
        self.view.backgroundColor = UIColor.white
        initNavItem(controller: self, imageName: "nav_back_n", highlitedImageName: "nav_back_h", selectedImageName: "", isLeft: true)
        self.title = "新增收货地址"
        
        let leftTittles = ["收件人：", "联系电话：", "省/市：", "城市：", "区/县：", "详细地址："]
        let placeholders = ["请填写收件人姓名", "请填写收件人联系电话", "请选择省/市", "请选择收件城市", "请选择区/县", "请输入收件详细地址"]
        
        for i in 0 ..< leftTittles.count {
            let height = i == leftTittles.count-1 ? 36 : 0
            let addView = AddAddressView(frame: CGRect(x: 0, y: i*44, width: Int(SCREEN_WIDTH), height: 44+height))
            addView.leftTittle = leftTittles[i]
            addView.placeholderStr = placeholders[i]
            addView.index = i
            addView.textView.tag = i+20
            addView.textView.delegate = self
            
            self.view.addSubview(addView)
        }
    }
    func initBaseLayout() {
        
    }
    func layoutPageSubviews() {
    
    }
    
    


}

extension AddAddressViewController: UITextViewDelegate {
    func textViewDidBeginEditing(_ textView: UITextView) {
        switch textView.tag {
        case 22:
            
            
            break
        case 23:
            break
        case 24:
            break
        default:
            break
        }
        

    }
}
